"""
    panel track
"""
import wx
from data import *

class track(wx.BoxSizer):
    def __init__(self, parent):
        self.parent = parent
        wx.BoxSizer.__init__(self, wx.HORIZONTAL)
        
        self.track_info = wx.TextCtrl(self.parent, -1, "No artist - No track", style=wx.TE_CENTRE|wx.NO_BORDER)
        self.track_time = wx.TextCtrl(self.parent, -1, "00:00", style=wx.TE_CENTRE|wx.NO_BORDER)
    
        self.__set_properties()
        self.__do_layout()
        
    def __set_properties(self):
        self.track_info.SetBackgroundColour(wx.Colour(0, 0, 0))
        self.track_info.SetForegroundColour(wx.Colour(50, 50, 204))
        self.track_info.SetFont(wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "FreeSans"))
        self.track_info.Enable(False)
        self.track_time.SetMinSize((50, 27))
        self.track_time.SetBackgroundColour(wx.Colour(0, 0, 0))
        self.track_time.SetForegroundColour(wx.Colour(50, 50, 204))
        self.track_time.SetFont(wx.Font(10, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "FreeSans"))
        self.track_time.Enable(False)
    
    def __do_layout(self):
        self.Add(self.track_info, 1, wx.EXPAND, 0)
        self.Add(self.track_time, 0, wx.EXPAND, 0)
    
    def setTrack(self, track):
        self.track_info.SetValue(track[1] + " - " + track[2])
    
    def setPlayTime(self, min, sec):
        self.track_time.SetValue("%s:%s" % (min,sec))